<?php
/**
 * Created by JetBrains PhpStorm.
 * User: Grom Hellscream
 * Date: 11/2/12
 * Time: 11:33 AM
 * To change this template use File | Settings | File Templates.
 */
// No direct access to this file
defined('_JEXEC') or die('Restricted access');
$document = JFactory::getDocument();

$congtrinhs = $this->get('congtrinhs');
$pagination = $this->get('pagination');
$session = JFactory::getSession();
$hosocanbos = $this->get('hosocanbo');
?>

<div id="crumbs">
    <div style="color: #222222;font-weight: normal;margin: 0;padding: 0">
        <a href="<?php echo JRoute::_('index.php?option=com_vast&view=vast') ?>">Trang chủ</a> »
        <span>Công trình khoa học</span>
    </div>
</div>

<div id="main" class="home">
    <h3 class="title green">Tra cứu thông tin các công trình nghiên cứu của các cán bộ trong viện</h3>

    <div class="search-form">
        <div class="wide form">
            <form id="commentform" class="commentform" class="form-validate" method="post" action="index.php?option=com_vast&view=congtrinhs">
    
                <div class="row">
                    <label style="text-align: left;">Tên công trình</label>		
                    <input size="60" maxlength="128" name="congtrinhTen" id="congtrinhTen" type="text" value="<?php if ($session->get('congtrinhs.ten') !== NULL) echo $session->get('congtrinhs.Ten'); ?>"/>	
                </div>
        
                <div class="row">
                    <label style="text-align: left;">Tác giả</label>		
                    <select style="width: 25%;" name="congtrinhHosocanbo" id="congtrinhHosocanbo">
                    <?php if ($session->get('congtrinhs.hosocanbo') == -1): ?>
                        <option value="-1" selected="selected">-Tất cả các tác giả-</option>
                    <?php else: ?>
                        <option value="-1">-Tất cả các tác giả-</option>
                    <?php endif; ?>
                    <?php foreach ($hosocanbos as $hosocanbo): ?>
                    <?php if ($session->get('congtrinhs.hosocanbo') == $hosocanbo->id): ?>
                        <option value="<?php echo $hosocanbo->id; ?>" selected="selected"><?php echo $hosocanbo->hoten; ?></option>
                    <?php else: ?>
                        <option value="<?php echo $hosocanbo->id; ?>"><?php echo $hosocanbo->hoten; ?></option>
                    <?php endif; ?>
                    <?php endforeach; ?>    
                    </select>
                </div>
                
                <div class="row buttons">
                    <input type="hidden" name="view" value="congtrinhs" />
                    <input id="submit" value="Tìm kiếm" type="submit"/>	
                    <?php echo JHtml::_('form.token'); ?>
                </div>
    
            </form>
        </div>
    </div>
    
    <div>
        <table id="rounded-corner">
            <thead>
                <tr>
                    <th scope="col" class="rounded-company" style="width: 200px;;"><a href="#ten">Tên</a></th>
                    <th scope="col" class="rounded-q1"><a href="#anpham">Ấn phẩm</a></th>
                    <th scope="col" class="rounded-q2" style="width: 70px;"><a href="#theloai">Thể loại</a></th>                                        
                    <th scope="col" class="rounded-q4"><a href="#tacgia">Tác giả</a></th>  
                </tr>    
    <!--            <tr>
                    <th scope="col" class="rounded-q1" width="30%"><input type="text"/></th>
                    <th scope="col" class="rounded-q1" width="15%"><input type="text"/></th>
                    <th scope="col" class="rounded-q1" width="15%"><input type="text"/></th>
                    <th scope="col" class="rounded-q1" width="20%"><input type="text"/></th>
                    <th scope="col" class="rounded-q1" width="20%"><input type="text"/></th>
                </tr>-->
            </thead>
            <tfoot>
                <tr>
                    <td colspan="3" class="rounded-foot-left">
                        <em>
                        </em>
                    </td>
                    <td class="rounded-foot-right" style="font-size: smaller;">
                    </td>
                </tr>
            </tfoot>
            <tbody>
                <?php foreach ($congtrinhs as $item) { ?>
                    <tr>
                        <td>
                            <a href="<?php echo JRoute::_('index.php?option=com_vast&view=quanlycongtrinh&layout=view&congtrinhid=' . $item->id . '&id=' . $item->hosocanbo_id) ?>"><?php echo $item->ten; ?></a>
                        </a></td>
                        <td>
                            <?= $item->anpham ?>
                        </td>
                        <td><?= $item->theloai ?></td>
                        <td>
                            <a href="<?php echo JRoute::_('index.php?option=com_vast&view=chitietcanbo&id=' . $item->hosocanbo_id) ?>"><?php echo $item->hoten; ?></a>
                        </td>
                    </tr>
                <?php } ?>
            </tbody>
        </table>
        <div id="tnt_pagination" style="margin-top: 5px;">
        <?php
            echo $pagination->getPagesLinks();
        ?>
        </div>            
    </div>
    <div style="float: left; width: 680px; margin-top: 5px;">
        <?php
        if (isset($_SERVER['HTTP_REFERER']))
        {
            $url = htmlspecialchars($_SERVER['HTTP_REFERER']);
            echo '<a title="Quay lại" href="' . $url . '"><span style="left: 610px; position: relative;">&laquo; Quay lại</span></a>';            
        }
        ?>    
    </div>    
</div>